package labox.innovation.loginserver.socket.serverpackets;

/**
 * 修改密码请求处理
 * 
 * @author Frank
 * 
 */
public final class ResponseChangePassWord extends LoginServerPacket {
	/**
	 * 修改密码操作结果代码<br>
	 * 0:修改密码成功<br>
	 * 1:用户不存在或密码错误<br>
	 * 2:新提交的密码不合法<br>
	 */
	public static final int RESPONSE_ALLOK = 0x00;

	public static final int RESPONSE_ACCOUNTORPASSWORD_ERROR = 0x01;

	public static final int RESPONSE_NEWPASSWORD_ERROR = 0x02;

	private int _code;

	private String _password;

	public ResponseChangePassWord(int code, String password) {
		_code = code;
		_password = password;
	}

	@Override
	protected void write() {
		writeByte(PTL_RESPONSECHANGEPASSWORD);
		writeByte(_code);
		if (_code == RESPONSE_ALLOK)
			writeString(_password);
	}
}
